﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TR.AppService.AppService;
using TR.AppService.Dto;
using TR.Domain.Entity;

namespace TR.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CsController : ControllerBase
    {
        private readonly ICsAppService csAppService;

        public CsController(ICsAppService csAppService)
        {
            this.csAppService = csAppService;
        }

        [Authorize]
        [HttpGet]
        public async Task<List<Cs>> CsSelect()
        {
            return await csAppService.CzSelete();
        }

        [HttpPost]
        public async Task<bool> CsAdds(AddCsDto addCsDto)
        {
            return await csAppService.CsAdd(addCsDto);
        }

        [HttpPost]
        public async Task<rbac_User> LoginUser(AddCsDto addCsDto)
        {
            return await csAppService.LoginUser(addCsDto);
        }
    }
}
